class Dom {
    constructor() {
        Element.prototype.css = css;
        Element.prototype.clear = clear;
    }
    id = (id: string): HTMLElement => {
        return document.getElementById(id)!;
    };
    className = (id: string): HTMLCollectionOf<Element> => {
        return document.getElementsByClassName(id);
    };
    tagName = (id: string): HTMLCollectionOf<Element> => {
        return document.getElementsByTagName(id);
    };
    querySelector = (id: string): NodeListOf<Element> => {
        return document.querySelectorAll(id);
    };
}
const css = function (this: HTMLElement, attributes: { [attribute: string]: any }) {
    let str = "";
    Object.keys(attributes).forEach((item) => {
        str += item + ":" + attributes[item] + ";";
    });
    // console.log(str);
    if (this) this.style.cssText = str;

    return this;
};

const clear = function (this: HTMLElement) {
    if (this) this.style.cssText = "";
    return this;
};
const dom = new Dom();
export default dom;
